<?php

namespace app\models;

use common\models\User;
use Yii;

/**
 * This is the model class for table "asr_call".
 *
 * @property int $call_id 拨打电话的记录的自增ID
 */
class AsrCall extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'asr_call';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['call_id'], 'required'],
            [['call_id'], 'integer'],
            [['call_id'], 'unique'],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'call_id' => '呼叫编号',
            'line' => '线路',
            'number' => '号码',
            'operator' => '运营商',
            'create_at' => '添加时间',
            'duration' => '拨打时长',
            'user_id' => '使用账户',
        ];
    }

    /*
     * 拿到用户
     */
    public function getUser(){
        return $this->hasOne(User::className(),['id' => 'user_id']);
    }

}
